import {CnMediumSpan, CnNormalP} from '@/components/text'
import {getDepartAndUser} from '@/libs/dingding'
import {defineComponent, ExtractPropTypes, PropType} from 'vue'

/**
 * 考评组 添加
 * 基础信息
 * 表格 table
 */
export const JichuxinxiTable = defineComponent({
  setup(props, {slots}) {
    return () => <table>{slots.default?.()}</table>
  }
})
/**
 * 考评组 添加
 * 基础信息
 * 表格行 tr
 */
export const JichuxinxiTR = defineComponent({
  setup(props, {slots}) {
    return () => <tr class='h-50'>{slots.default?.()}</tr>
  }
})
/**
 * 考评组 添加
 * 基础信息
 * 表格头 thead
 */
export const JichuxinxiTHead = defineComponent({
  setup(props, {slots}) {
    return () => <thead>{slots.default?.()}</thead>
  }
})
/**
 * 考评组 添加
 * 基础信息
 * 表格头的单元格 th
 */
export const JichuxinxiTh = defineComponent({
  setup(props, {slots}) {
    return () => <th class='text-14'>{slots.default?.()}</th>
  }
})
/**
 * 考评组 添加
 * 基础信息
 * 表格body tbody
 */
export const JichuxinxiTBody = defineComponent({
  setup(props, {slots}) {
    return () => <tbody>{slots.default?.()}</tbody>
  }
})
/**
 * 考评组 添加
 * 基础信息
 * 表格body的label单元格 td
 */
export const JichuxinxiTdLabel = defineComponent({
  setup(props, {slots}) {
    return () => (
      <td class='text-right pr-12'>
        <CnMediumSpan class='text-12 text-2xText '>{slots.default?.()}</CnMediumSpan>
      </td>
    )
  }
})
/**
 * 考评组 添加
 * 基础信息
 * 表格body的value单元格 td
 */
export const JichuxinxiTdValue = defineComponent({
  setup(props, {slots}) {
    return () => <td>{slots.default?.()}</td>
  }
})

//? 考评组名称 start -----------------------------------
export const pmGroupNameEmit = {
  'update:pmGroupName': (data: string): boolean => true
}
export const pmGroupNameProps = {
  pmGroupName: String
}

//! 考评组名称 end -----------------------------------

//? 周期类型 start -----------------------------------
export enum pmPeriodCodeEnum {
  '0025' = '月度',
  '0026' = '季度',
  '0027' = '半年度',
  '0028' = '年度',
  '0029' = '自定义'
}
export const periodTypeEmit = {
  'update:pmPeriodCode': (data: PmPeriodCode): boolean => true,
  'update:pmPeriodName': (data: PmPeriodName): boolean => true
}
export const periodTypeProps = {
  pmPeriodCode: String as PropType<PmPeriodCode>,
  pmPeriodName: String as PropType<PmPeriodName>
}

//! 周期类型 end -----------------------------------

//? 指定评分人开关 start -----------------------------------
export const AppointScoreSwitchEmit = {
  'update:appointScoreSwitch': (data: AppointScoreSwitch): boolean => true
}
export const AppointScoreSwitchProps = {
  appointScoreSwitch: Number as PropType<AppointScoreSwitch>
}
//! 指定评分人开关 end -----------------------------------

//? 考评员工 start -----------------------------------
export const pmGroupEmployeeProps = {
  pmGroupUserList: Array as PropType<Evaluation.PmGroupUser[]>,
  pmGroupDeptList: Array as PropType<Evaluation.PmGroupDept[]>
}
export const pmGroupEmployeeEmit = {
  'update:pmGroupUserList': (data: Evaluation.PmGroupUser[]): boolean => true,
  'update:pmGroupDeptList': (data: Evaluation.PmGroupDept[]): boolean => true
}
//! 考评员工 end -----------------------------------

//? 被排除的员工 -----------------------------------
export const pmGroupExcUserProps = {
  pmGroupExcUserList: Array as PropType<Evaluation.PmGroupExcUser[]>
}
export const proupmGEmployeeEmiEmit = {
  'update:pmGroupExcUserList': (data: Evaluation.PmGroupExcUser[]): boolean => true
}
